home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / disk / misc / Mtools207.lha / Mtools-2.0.7 / src / devices.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-27  |  5.0 KB  |  185 lines

  1. /*
  2.  * Device tables.  See the Configure file for a complete description.
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include "msdos.h"
  7.  
  8. #ifdef AMIGA
  9. struct device devices[] = {
  10. /*    {'A', "/flat/PC0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18}, */
  11.     {'A', "mfm.device",  0L, 12, 0, (int (*) ()) 0, 0, -1, 13},
  12.     {'B', "scsi.device", 0L, 16, 1, (int (*) ()) 0, 0, -1, 0}
  13. /*                              ^ Unit Nr!! */
  14. };
  15. #endif /* DELL */
  16.  
  17. #ifdef DELL
  18. struct device devices[] = {
  19.     {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  20.     {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  21.     {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},
  22.     {'B', "/dev/rdsk/f13ht", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  23.     {'B', "/dev/rdsk/f13dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  24.     {'C', "/dev/rdsk/dos", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
  25.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  26. };
  27. #endif /* DELL */
  28.  
  29. #ifdef ISC
  30. struct device devices[] = {
  31.     {'A', "/dev/rdsk/f0d9dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  32.     {'A', "/dev/rdsk/f0q15dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  33.     {'A', "/dev/rdsk/f0d8dt", 0L, 12, 0, (int (*) ()) 0, 40, 2, 8},
  34.     {'B', "/dev/rdsk/f13ht", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  35.     {'B', "/dev/rdsk/f13dt", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  36.     {'C', "/dev/rdsk/0p1", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
  37.     {'D', "/usr/vpix/defaults/C:", 8704L, 12, 0, (int (*) ()) 0, 0, 0, 0},
  38.     {'E', "$HOME/vpix/C:", 8704L, 12, 0, (int (*) ()) 0, 0, 0, 0},
  39.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  40. };
  41. #endif /* ISC */
  42.  
  43. #ifdef SPARC
  44. struct device devices[] = {
  45.     {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  46.     {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  47.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  48. };
  49. #endif /* SPARC */
  50. #ifdef RT_ACIS
  51. struct device devices[] = {
  52.       {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  53.       {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  54.       {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  55. };
  56. #endif /* RT_ACIS */
  57.  
  58.  
  59. #ifdef UNIXPC
  60. #include <sys/gdioctl.h>
  61. #include <fcntl.h>
  62.  
  63. int init_unixpc();
  64.  
  65. struct device devices[] = {
  66.     {'A', "/dev/rfp020", 0L, 12, O_NDELAY, init_unixpc, 40, 2, 9},
  67.     {'C', "/usr/bin/DOS/dvd000", 0L, 12, 0, (int (*) ()) 0, 0, 0, 0},
  68.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  69. };
  70.  
  71. int
  72. init_unixpc(fd, ntracks, nheads, nsect)
  73. int fd, ntracks, nheads, nsect;
  74. {
  75.     struct gdctl gdbuf;
  76.  
  77.     if (ioctl(fd, GDGETA, &gdbuf) == -1) {
  78.         ioctl(fd, GDDISMNT, &gdbuf);
  79.         return(1);
  80.     }
  81.  
  82.     gdbuf.params.cyls = ntracks;
  83.     gdbuf.params.heads = nheads;
  84.     gdbuf.params.psectrk = nsect;
  85.  
  86.     gdbuf.params.pseccyl = gdbuf.params.psectrk * gdbuf.params.heads;
  87.     gdbuf.params.flags = 1;        /* disk type flag */
  88.     gdbuf.params.step = 0;        /* step rate for controller */
  89.     gdbuf.params.sectorsz = 512;    /* sector size */
  90.  
  91.     if (ioctl(fd, GDSETA, &gdbuf) < 0) {
  92.         ioctl(fd, GDDISMNT, &gdbuf);
  93.         return(1);
  94.     }
  95.     return(0);
  96. }
  97. #endif /* UNIXPC */
  98.  
  99. #ifdef RT_ACIS
  100. struct device devices[] = {
  101.     {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  102.     {'A', "/dev/rfd0", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  103.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  104. };
  105. #endif /* RT_ACIS */
  106.  
  107. #ifdef SUN386
  108. struct device devices[] = {
  109.     {'A', "/dev/rfdl0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  110.     {'A', "/dev/rfd0c", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  111.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  112. };
  113. #endif /* SUN386 */
  114.  
  115.   
  116. #ifdef SPARC_ODD
  117. #include <sys/types.h>
  118. #include <sun/dkio.h>
  119. #include <fcntl.h>
  120.  
  121. int init_sparc();
  122.  
  123. struct device devices[] = {
  124.     {'A', "/dev/rfd0c", 0L, 12, 0, init_sparc, 80, 2, 0},
  125.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  126. };
  127.  
  128. /*
  129.  * Stuffing back the floppy parameters into the driver allows for gems
  130.  * like 10 sector or single sided floppies from Atari ST systems.
  131.  * 
  132.  * Martin Schulz, Universite de Moncton, N.B., Canada, March 11, 1991.
  133.  */
  134.  
  135. int
  136. init_sparc(fd, ntracks, nheads, nsect)
  137. int fd, ntracks, nheads, nsect;
  138. {
  139.     struct fdk_char dkbuf;
  140.     struct dk_map   dkmap;
  141.  
  142.     if (ioctl(fd, FDKIOGCHAR, &dkbuf) != 0) {
  143.         ioctl(fd, FDKEJECT, NULL);
  144.         return(1);
  145.     }
  146.  
  147.     if (ioctl(fd, DKIOCGPART, &dkmap) != 0) {
  148.         ioctl(fd, FDKEJECT, NULL);
  149.         return(1);
  150.     }
  151.  
  152.     if (ntracks)
  153.         dkbuf.ncyl = ntracks;
  154.     if (nheads)
  155.         dkbuf.nhead = nheads;
  156.     if (nsect)
  157.         dkbuf.secptrack = nsect;
  158.  
  159.     if (ntracks && nheads && nsect )
  160.         dkmap.dkl_nblk = ntracks * nheads * nsect;
  161.  
  162.     if (ioctl(fd, FDKIOSCHAR, &dkbuf) != 0) {
  163.         ioctl(fd, FDKEJECT, NULL);
  164.         return(1);
  165.     }
  166.  
  167.     if (ioctl(fd, DKIOCSPART, &dkmap) != 0) {
  168.         ioctl(fd, FDKEJECT, NULL);
  169.         return(1);
  170.     }
  171.     return(0);
  172. }
  173. #endif /* SPARC_ODD */
  174.   
  175. #ifdef XENIX
  176. struct device devices[] = {
  177.     {'A', "/dev/fd096ds15", 0L, 12, 0, (int (*) ()) 0, 80, 2, 15},
  178.     {'A', "/dev/fd048ds9", 0L, 12, 0, (int (*) ()) 0, 40, 2, 9},
  179.     {'B', "/dev/fd1135ds18", 0L, 12, 0, (int (*) ()) 0, 80, 2, 18},
  180.     {'B', "/dev/fd1135ds9", 0L, 12, 0, (int (*) ()) 0, 80, 2, 9},
  181.     {'C', "/dev/hd0d", 0L, 16, 0, (int (*) ()) 0, 0, 0, 0},
  182.     {'\0', (char *) NULL, 0L, 0, 0, (int (*) ()) 0, 0, 0, 0}
  183. };
  184. #endif /* XENIX */
  185.